package com.cxyd.modules.wcs.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cxyd.common.page.PageData;
import com.cxyd.common.service.impl.CrudServiceImpl;
import com.cxyd.modules.wcs.dao.LocateDao;
import com.cxyd.modules.wcs.dto.LocateDTO;
import com.cxyd.modules.wcs.entity.LocateEntity;
import com.cxyd.modules.wcs.service.LocateService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class LocateServiceImpl extends CrudServiceImpl<LocateDao, LocateEntity, LocateDTO> implements LocateService {
    @Override
    public QueryWrapper<LocateEntity> getWrapper(Map<String, Object> params) {
        String dvcNo = (String) params.get("dvcNo");
        String locateNo = (String) params.get("locateNo");
        String contNo = (String) params.get("contNo");
        QueryWrapper<LocateEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(dvcNo), "dvc_no", dvcNo);
        wrapper.like(StringUtils.isNotBlank(locateNo), "locate_no", locateNo);
        wrapper.like(StringUtils.isNotBlank(contNo), "cont_no", contNo);
        return wrapper;
    }

    @Override
    public PageData<LocateDTO> page(Map<String, Object> params) {
        return super.page(params);
    }
}
